#include <vector>

using namespace std;

class Solution {
public:
    int minStartValue(vector<int>& nums) {
        int ans = 1;
        int sum = 0;
        for (int& num : nums) {
            sum += num;
            if (sum < 1) {
                ans = max(ans, 1 - sum);
            }
        }
        return ans;
    }
};